import java.util.*;

/**
 * 按职位统计员工人数，以表格形式展示每个职位及其对应的员工数量
 */
public class JobAver {
    public static void jobAver(List<Map<String, Object>> a) {
        //创建一个新的集合用来装职位对应的人数
        TreeMap<String, Integer> jobTree = new TreeMap<>();
        for (Map<String, Object> map : a) {
            String job = map.get("job").toString();
            if (jobTree.containsKey(job)) {
                jobTree.put(job, jobTree.get(job) + 1);
            } else {
                jobTree.put(job, 1);
            }
        }
        Set<Map.Entry<String, Integer>> entries = jobTree.entrySet();
        for (Map.Entry<String, Integer> entry : entries) {
            System.out.println(entry);
        }
    }
}

